package com.ruoyi.community.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.community.domain.*;
import com.ruoyi.community.mapper.PayCostMapper;
import com.ruoyi.community.mapper.PayHisHouseMapper;
import com.ruoyi.community.mapper.PayHistoryMapper;
import com.ruoyi.community.mapper.PayOrdersMapper;
import com.ruoyi.community.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * PayService业务层处理
 *
 * @author ruoyi
 * @date 2021-07-30
 */
@Service
public class PayServiceImpl implements PayService
{
    @Autowired
    private PayHisHouseMapper payHisHouseMapper;

    @Autowired
    private PayCostMapper payCostMapper;

    @Autowired
    private PayOrdersMapper payOrdersMapper;

    @Autowired
    private PayHistoryMapper payHistoryMapper;

    /**
     * app端根据houseID查询待缴费信息
     *
     * @param houseId 房屋ID
     * @return 缴费项集合
     */
    public List<PayHisHouse> selectPayHisHouseByHouseId(Integer houseId){
        return payHisHouseMapper.selectByHouseId(houseId);
    }

    /**
     * app端根据costId查询缴费项信息
     *
     * @param costId 缴费项id
     * @return 具体缴费项
     */
    public PayCost selectPayCost(Integer costId){
        return payCostMapper.selectByPrimaryKey(costId);
    }


    /**
     * app端修改待缴费为已交费
     *
     * @param record
     * @return 结果
     */
    public int updatePayHisHouse(PayHisHouse record){
        return payHisHouseMapper.updateByPrimaryKey(record);
    }


    /**
     * app端根据houseId查询已缴费记录
     *
     * @param houseId
     * @return 缴费项
     */
    public List<PayOrders> selectPayOrders(Integer houseId){
        return payOrdersMapper.selectByHouseId(houseId);
    }

    /**
     * app端根据orderid查询缴费记录中具体项目
     *
     * @param orderId
     * @return 具体缴费内容
     */
    public List<PayHisHouse> selectPayHisHouse(Long orderId){
        return payHisHouseMapper.selectByOrderId(orderId);
    }



    /**
     * app端修改支付项

     */
    public int changePayHisHouse(PayHisHouse payHisHouse){
        return payHisHouseMapper.updateByPrimaryKey(payHisHouse);
    }

    public int insertPayOrders(PayOrders payOrders){
        return payOrdersMapper.insertSelective(payOrders);
    }

    public PayHisHouse selectByPrimaryKey(PayHisHouseKey key){
        return payHisHouseMapper.selectByPrimaryKey(key);
    }

    public List<PayHisHouse> selectByHisId(Integer hisId){
        return payHisHouseMapper.selectByHisId(hisId);

    }

    public PayHistory selectPayHistoryByPrimaryKey(Integer hisId){
        return payHistoryMapper.selectByPrimaryKey(hisId);
    }

}
